package com.health.mapp.bean;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.apache.commons.codec.binary.Hex;
import org.codehaus.jackson.annotate.JsonProperty;

import com.alibaba.fastjson.annotation.JSONField;
import com.health.db.model.UserLISTTemp;
import com.health.mapp.utils.Response;

public class RegisterForPartnerResp extends Response {
	private String uid;

	private UserLISTTemp user;
	
	@JsonProperty("Token")
    @JSONField(name = "Token")
    private String token;

	/**
	 * @return the uid
	 */
	public String getUid() {
		return uid;
	}

	/**
	 * @param uid the uid to set
	 */
	public void setUid(String uid) {
		this.uid = uid;
	}


	/**
	 * @return the user
	 */
	public UserLISTTemp getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(UserLISTTemp user) {
		this.user = user;
	}

	
    public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	private  String getSign(String partner_key, String atime, String user_phone) throws NoSuchAlgorithmException  {
        String info = partner_key + atime + user_phone;
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        byte[] srcBytes = info.getBytes(); md5.update(srcBytes);
        byte[] resultBytes = md5.digest();
        String resultString = new String(new Hex().encode(resultBytes));
        return resultString.substring(8, 24);
    }

    public static void main(String[] args) {
       String  partner="yihudaojia";
       String partner_key="T00VRCuiyt7T2Bbz";
       RegisterForPartnerResp pl = new RegisterForPartnerResp();
       String sing ="";
	try {
		sing = pl.getSign(partner_key,"20170626","13405851953");
	} catch (NoSuchAlgorithmException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

       // f4483733d8c2c4a6s
    }
	

}
